package com.lm.jsoup.example;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class JsoupFormExample {
    public static void main(String[] args) {
        try {
            // 提交表单
            Connection.Response response = Jsoup.connect("https://example.com/login")
                    .data("username", "user123")
                    .data("password", "pass123")
                    .method(Connection.Method.POST)
                    .execute();

            // 获取响应的 HTML
            Document document = response.parse();
            System.out.println("Response: " + document.body().text());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
